/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc;

/**
 * <p>Project: SpringPro - DineServiceProxy</p>
 * <p>Powered by yzc On 2023-10-19 14:36:12</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */

/**
 * 代理类 ：静态代理
 */
public class DineServiceProxy implements DineService {
    /**
     * 接受目标类的对象 可以理解为dineService 就是目标类的引用
     */
    DineService dineService;

    public DineServiceProxy(DineService dineService) {
        this.dineService = dineService;
    }


    /**
     * 加入横切逻辑 调用目标方法 横切逻辑可以理解为你想让代理类帮你完成的事
     */
    @Override
    public void eat() {
        dineService.eat();
        System.out.println("取餐");
    }
}
